You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ktmud Setting testEnv to enzyme enables jest-environment-enzyme package. This package helps to configure Jest and React integration by setting enzyme adapter and adding React and enzyme to the global scope so we don't need to import them in our tests. As I can tell none of these benefits are being used because our tests are importing React and enzyme in test files and spec/helpers/shim.ts is configuring the adapter. Another thing that corroborates this thesis is that our tests successfully execute when we change testEnv to js-dom.
The error happens when testEnv equals enzyme because jest-environment-enzyme depends on js-dom 11.12.0 and MutationObserver was introduced in version 13.2.0. When we changed testEnv to js-dom the dependency used is 16.4.0 as you can see in the following image:
mistercrunch
added
🏷️ bot
A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels
🚢 1.2.0
First shipped in 1.2.0
labels
Mar 12, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🏷️ botA label used by `supersetbot` to keep track of which PR where auto-tagged with release labelssize/XStest:component🚢 1.2.0First shipped in 1.2.0
6 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Change test environment to
jsdom(default when installed) so we can use react-testing-library functions that listen for DOM mutations like findBy.Test environment with
enzymeoption was causing TypeError: MutationObserver is not a constructor@ktmud @rusackas @geido
Add to #13079
TEST PLAN
1 - Execute all jest tests
2 - All tests should pass
ADDITIONAL INFORMATION